#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
void solve()
{
    int n = 0;
    cin >> n;
    vector<ll> c(n + 10);
    int i = 0;
    ll Max = LONG_LONG_MIN;
    int tag = 1;
    for (i = 0; i < n; i++)
    {
        cin >> c[i];
        if (c[i] > 0)
            tag = 0;
        if (c[i] > Max)
            Max = c[i];
    }
    if (tag == 1)
        cout << Max << endl;
    else
    {
        ll ans1 = 0, ans2 = 0;
        for (i = 0; i < n; i++)
        {
            if (i % 2 == 1)
                ans1 += max(c[i], (ll)0);
            else
                ans2 += max(c[i], (ll)0);
        }
        cout << max(ans1, ans2) << endl;
    }
}
int main()
{
    int t = 0;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}
